import 'package:family_expense/features/account_user/widgets/account_group_user_details.dart';
import 'package:family_expense/features/account_user/widgets/account_group_user_list.dart';
import 'package:family_expense/features/account_user/widgets/account_group_user_security.dart';
import 'package:family_expense/features/account_user/widgets/add_account_group_user.dart';
import 'package:family_expense/features/account_user/widgets/join_account_group_request_list.dart';
import 'package:family_expense/features/account_user/widgets/login_device_list.dart';
import 'package:family_expense/features/account_user/widgets/reset_login_password.dart';
import 'package:family_expense/features/account_user/widgets/update_account_group_user.dart';
import 'package:family_expense/features/account_user/widgets/user_avatar.dart';
import 'package:family_expense/features/account_user/widgets/user_basic_info.dart';
import 'package:family_expense/features/authentication/widgets/account_register.dart';
import 'package:family_expense/features/authentication/widgets/account_unregister.dart';
import 'package:family_expense/features/authentication/widgets/password_login.dart';
import 'package:family_expense/features/authentication/widgets/quick_login.dart';
import 'package:family_expense/features/bank_card/widgets/add_bank_card.dart';
import 'package:family_expense/features/bank_card/widgets/bank_card_home.dart';
import 'package:family_expense/features/bank_card/widgets/bank_card_info.dart';
import 'package:family_expense/features/credit_card_bill/widgets/credit_card_bill_view.dart';
import 'package:family_expense/features/income_expense/widgets/edit_income_expense_detail.dart';
import 'package:family_expense/features/income_expense/widgets/income_expense_detail_view.dart';
import 'package:family_expense/features/income_expense/widgets/map_footmark.dart';
import 'package:family_expense/features/income_expense_analysis/widgets/income_expense_annual_analysis.dart';
import 'package:family_expense/features/income_expense_detail_type/widgets/edit_income_expense_detail_type.dart';
import 'package:family_expense/features/income_expense_detail_type/widgets/income_expense_detail_type_home.dart';
import 'package:family_expense/features/income_expense_detail_type/widgets/income_expense_detail_type_info.dart';
import 'package:family_expense/features/income_expense_search/widgets/income_expense_search_home.dart';
import 'package:family_expense/features/income_expense_search/widgets/income_expense_search_result.dart';
import 'package:family_expense/features/journey/widgets/edit_journey.dart';
import 'package:family_expense/features/journey/widgets/edit_journey_income_expense_detail.dart';
import 'package:family_expense/features/journey/widgets/journey_footmark.dart';
import 'package:family_expense/features/journey/widgets/journey_home.dart';
import 'package:family_expense/features/journey/widgets/journey_income_expense_detail_view.dart';
import 'package:family_expense/features/journey/widgets/journey_income_expense_list.dart';
import 'package:family_expense/features/journey/widgets/journey_list.dart';
import 'package:family_expense/features/system_setting/widgets/about_view.dart';
import 'package:family_expense/features/system_setting/widgets/app_permission_setting.dart';
import 'package:family_expense/features/system_setting/widgets/app_update_info.dart';
import 'package:family_expense/features/system_setting/widgets/change_log.dart';
import 'package:family_expense/features/system_setting/widgets/general_setting_view.dart';
import 'package:family_expense/features/system_setting/widgets/primary_color_setting_view.dart';
import 'package:family_expense/features/system_setting/widgets/system_setting_home.dart';
import 'package:family_expense/features/system_setting/widgets/theme_setting_view.dart';
import 'package:family_expense/main_view.dart';
import 'package:my_flutter_baidu_map/widgets/map_location_selector.dart';
import 'package:my_flutter_core/my_flutter_core.dart';

/// IMPORTANT!!!
///
/// Named route is NOT recommended anymore.
/// https://docs.flutter.dev/development/ui/navigation
///
/// Now we use:
/// - go_router for web.
/// - Navigator for others.
class RouteMapConfig {
  static final Map<Type, String> navigatorConfig = {
    // region: The configuration allows anonymous access.
    AccountRegister: RouteMapManager.permitAll,
    AccountRegisterCompleted: RouteMapManager.permitAll,
    AppPermissionSetting: RouteMapManager.permitAll,
    SingleInputField: RouteMapManager.permitAll,
    PasswordLogin: RouteMapManager.permitAll,
    QuickLogin: RouteMapManager.permitAll,
    // endregion

    // region: The configuration allows authenticated access.
    AboutView: RouteMapManager.isAuthenticated,
    AccountGroupUserDetails: RouteMapManager.isAuthenticated,
    AccountGroupUserList: RouteMapManager.isAuthenticated,
    AccountGroupUserSecurity: RouteMapManager.isAuthenticated,
    AccountUnregister: RouteMapManager.isAuthenticated,
    AppUpdateInfo: RouteMapManager.isAuthenticated,
    BankCardHome: RouteMapManager.isAuthenticated,
    BankCardInfo: RouteMapManager.isAuthenticated,
    ChangeLog: RouteMapManager.isAuthenticated,
    CreditCardBillView: RouteMapManager.isAuthenticated,
    GeneralSettingView: RouteMapManager.isAuthenticated,
    IncomeExpenseDetailView: RouteMapManager.isAuthenticated,
    IncomeExpenseAnnualAnalysis: RouteMapManager.isAuthenticated,
    IncomeExpenseDetailTypeHome: RouteMapManager.isAuthenticated,
    IncomeExpenseDetailTypeInfo: RouteMapManager.isAuthenticated,
    IncomeExpenseSearchHome: RouteMapManager.isAuthenticated,
    IncomeExpenseSearchResult: RouteMapManager.isAuthenticated,
    JoinAccountGroupRequestList: RouteMapManager.isAuthenticated,
    JourneyFootmark: RouteMapManager.isAuthenticated,
    JourneyHome: RouteMapManager.isAuthenticated,
    JourneyList: RouteMapManager.isAuthenticated,
    JourneyIncomeExpenseDetailView: RouteMapManager.isAuthenticated,
    JourneyIncomeExpenseList: RouteMapManager.isAuthenticated,
    LoginDeviceList: RouteMapManager.isAuthenticated,
    MainView: RouteMapManager.isAuthenticated,
    MapFootmark: RouteMapManager.isAuthenticated,
    MapLocationSelector: RouteMapManager.isAuthenticated,
    PrimaryColorSettingView: RouteMapManager.isAuthenticated,
    ResetLoginPassword: RouteMapManager.isAuthenticated,
    SystemSettingHome: RouteMapManager.isAuthenticated,
    ThemeSettingView: RouteMapManager.isAuthenticated,
    UserAvatar: RouteMapManager.isAuthenticated,
    UserBasicInfo: RouteMapManager.isAuthenticated,
    // endregion

    // region: The configuration only allows account group user and admin access.
    EditIncomeExpenseDetail: RouteMapManager.hasAnyRole(
        [UserRole.accountGroupUser, UserRole.accountGroupAdmin]),
    EditJourney: RouteMapManager.hasAnyRole(
        [UserRole.accountGroupUser, UserRole.accountGroupAdmin]),
    EditJourneyIncomeExpenseDetail: RouteMapManager.hasAnyRole(
        [UserRole.accountGroupUser, UserRole.accountGroupAdmin]),
    // endregion

    // region: The configuration allows account group admin access.
    AddAccountGroupUser: RouteMapManager.hasRole(UserRole.accountGroupAdmin),
    AddBankCard: RouteMapManager.hasRole(UserRole.accountGroupAdmin),
    EditIncomeExpenseDetailType:
        RouteMapManager.hasRole(UserRole.accountGroupAdmin),
    UpdateAccountGroupUser: RouteMapManager.hasRole(UserRole.accountGroupAdmin),
    // endregion
  };
}
